package com.hr.app;


import com.hr.approval.entity.ApprovalData;
import com.hr.bigData.entity.ApprovalDataEchartsVO;
import com.hr.approval.service.ApprovalDataService;
import com.hr.classes.entity.dto.TbWorkRecordDTO;
import com.hr.classes.service.TbWorkRecordService;
import com.hr.common.retrun.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/app")
@CrossOrigin
public class AppController {

    @Autowired
    private ApprovalDataService approvalDataService;
    @Autowired
    private TbWorkRecordService tbWorkRecordService;
    /**
     *
     * @return
     */
    @GetMapping("/list")
    public R getApprovalDataList() {
        List<ApprovalData> approvalData = approvalDataService.getApprovalDataList();
        return R.ok(approvalData);
    }

    /**
     * echars的数据 根据申请类别分别返回数组
     * @return
     */
    @GetMapping("/echarts")
    public R getApprovalDataEcharts() {
        ApprovalDataEchartsVO approvalData = approvalDataService.getApprovalDataEcharts();
        return R.ok(approvalData);
    }
    /**
     * echars的数据 根据申请类别分别返回数组
     * @return
     */
    @PostMapping("/inClockOK")
    public R inClockOK(@RequestBody TbWorkRecordDTO tbWorkRecordDTO) {
        return tbWorkRecordService.inClockOK(tbWorkRecordDTO);
    }
    @GetMapping("/getTodayClockInfo")
    public R getTodayClockInfo(TbWorkRecordDTO tbWorkRecordDTO) {
        return tbWorkRecordService.getTodayClockInfo(tbWorkRecordDTO);
    }

}
